//
//  Status.swift
//  JIMWeiBo
//
//  Created by 陈恒均 on 2018/2/11.
//  Copyright © 2018年 陈恒均. All rights reserved.
//

import UIKit

class Status: NSObject {
    
    // MARK:- 属性
    var created_at : String?
    var source : String?                    // 微博来源
    var text : String?                      // 微博的正文
    var mid : String?               // 微博的ID
    
    //用户数据
    var user : User?
    //微博的配图
    
    var pic_urls : [[String : String]]?
    
    
    var retweeted_status : Status?          //转发微博
    
  
    
    override init() {
        super.init()
    }
    
    init(dict : [String : Any]) {
        super.init()
        created_at = dict["created_at"] as? String
        source = dict["source"] as? String
        text = dict["text"] as? String
        mid = dict["mid"] as? String
        pic_urls = dict["pic_urls"] as? [[String : String]]
        //把用户数据转成模型
        if let userDict = dict["user"] as? [String :Any]{
            user = User(dict: userDict)
        }
        if let retweetedStatusDict = dict["retweeted_status"]as? [String : Any]{
            retweeted_status = Status(dict: retweetedStatusDict)
        }
   
        
    }
    
    override func setValue(_ value: Any?, forUndefinedKey key: String) {
        
    }
}
